package com.example.demo.control;

import com.alibaba.fastjson.JSON;
import com.example.demo.pojo.GrWorkerOrder;
import com.example.demo.pojo.Worker;
import com.example.demo.service.WorkerOrdeshowService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@ResponseBody
@Controller
public class WorkerOrderControl {
    @Resource
    WorkerOrdeshowService workerOrdeshowService;
    @PostMapping("/c/WorkerOrderControl/show")
    public String WorkerOrderControlshow(String stateid,String name,String thispage){
        PageInfo<Worker> workerPageInfo =workerOrdeshowService.workerinfo(Integer.parseInt(thispage),1,-1,name,stateid);
        return JSON.toJSONString(workerPageInfo);
    }

    @PostMapping("/c/WorkerOrderControl/update")
    public String WorkergrOrderControlshow(String state,String seq){
        String workerPageInfo =workerOrdeshowService.workerupdete(state,seq);
        return JSON.toJSONString(workerPageInfo);
    }

    @PostMapping("/c/WorkerOrderControl/grShow")
    public String WorkerOrderControlgrshow(String state,String seq,String buseq,String thispage1){
        PageInfo<GrWorkerOrder> workerPageInfo =workerOrdeshowService.pageinfo(Integer.parseInt(thispage1),5,"","","",seq,buseq);
        return JSON.toJSONString(workerPageInfo);
    }

    @PostMapping("/c/WorkerOrderControl/grdel")
    public String WorkerOrderControlgrdel(String seq){
        String a=workerOrdeshowService.c_workerdel(Integer.parseInt(seq));
        return JSON.toJSONString(a);
    }
}
